import React, { Component } from 'react';

import Header from '../informations/InformationsViews'
import Bao from './baojuView'

class Baoju extends Component {
    state = { 
        title:'举报维权',
        list:[]
     }
    render() { 
        return (  
            <>
                <Header title={this.state.title} back={()=>this.goBack()  }></Header>
                <Bao tijiao={()=>this.tijjao()} changeImage={(e)=>this.getem(e)} list={this.state.list} leng={this.state.list.length} heig={Math.floor(this.state.list.length/3)}></Bao>
            </>
        );
    }
    tijjao(){
        this.props.history.go(-1)
    }
    goBack(){
        this.props.history.go(-1)
    }
     getem(e) {
        let $target = e.target || e.srcElement
        let file = $target.files[0]
        let headerImg='aaa'
        var reader = new FileReader()
        reader.onload =async function(data) {
          let res = data.target || data.srcElement
          headerImg=  res.result
        }
    
        reader.readAsDataURL(file)
        setTimeout(() => {
            this.state.list.push(headerImg)
            this.setState({
                list:this.state.list
            })
        }, 1000);
      }
}
 
export default Baoju ;